﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PrintPage.aspx.cs" Inherits="YBApproval.PrintPage" %>
<%@ Register src="PrintForms/QingjiaPrint.ascx" tagname="QingjiaPrint" tagprefix="uc1" %>
<%@ Register src="PrintForms/QingjiaPQ.ascx" tagname="QingjiaPQ" tagprefix="uc2" %>
<%@ Register src="PrintForms/ChuchaiPrint.ascx" tagname="ChuchaiPrint" tagprefix="uc3" %>
<%@ Register src="PrintForms/QingjiaZhaohui.ascx" tagname="QingjiaZhaohui" tagprefix="uc4" %>
<%@ Register src="PrintForms/JiashuLaidui.ascx" tagname="JiashuLaidui" tagprefix="uc5" %>
<%@ Register src="PrintForms/CheliangShiyong.ascx" tagname="CheliangShiyong" tagprefix="uc6" %>
<%@ Register src="PrintForms/YingFang.ascx" tagname="YingFang" tagprefix="uc7" %>
<%@ Register src="PrintForms/Qingshi.ascx" tagname="Qingshi" tagprefix="uc8" %>
<%@ Register src="PrintForms/PhoneRecord.ascx" tagname="PhoneRecord" tagprefix="uc9" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<%--<head runat="server">
    <title>打印</title>
    <object id="wb1" classid="clsid:8856f961-340a-11d0-a96b-00c04fd705a2" height="0" width="0" ></object>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table>
    <tr><td>
<input type="button" value="打印" onclick="wb1.ExecWB(6,1)" />
<input type="button" value="页面设置" onclick="wb1.ExecWB(8,1)" />
<input type="button" value="打印预览" onclick="wb1.ExecWB(7,1)" />
<input type="button" value="打开" onclick="wb1.ExecWB(1,1)" />
<input type="button" value="保存" onclick="wb1.ExecWB(4,1)" />
<input type="button" value="属性" onclick="wb1.ExecWB(10,1)" />
<input type="button" value="全选" onclick="wb1.ExecWB(17,1)" />
<input type="button" value="刷新" onclick="wb1.ExecWB(22,1)" />
<input type="button" value="关闭" onclick="wb1.ExecWB(45,1)" /></td></tr>
<tr><td>tests print is page</td></tr>
    </table>
    </div>
    </form>
</body>
</html>
--%>

<HEAD>
<TITLE>打印</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gbk" />
<SCRIPT type="text/javascript">
var hkey_root,hkey_path,hkey_key;
hkey_root="HKEY_CURRENT_USER";
<!--地址的写法很严格的用双斜杠-->
hkey_path="\Software\Microsoft\Internet Explorer\PageSetup";
//设置网页打印的页眉页脚为空
function pagesetup_null(){
try{
var RegWsh = new ActiveXObject("WScript.Shell");
hkey_key="\header";
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"");
hkey_key="\footer";
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"");
}catch(e){}
}
//设置网页打印的页眉页脚为默认值
function pagesetup_default(){
try{
var RegWsh = new ActiveXObject("WScript.Shell");
hkey_key="\header" ;
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&w&b页码,&p/&P");
hkey_key="\footer";
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&u&b&d");
}catch(e){}
}
function printsetup(){ 
 wb.execwb(8,1); // 打印页面设置
}
function printpreview(){ 
 wb.execwb(7,1);// 打印页面预览
}
function printit() {
 if (confirm('确定打印吗？')) {
  wb.execwb(6,1);
 }
}
</SCRIPT>
<!--media=print 这个属性说明可以在打印时有效-->
<!--希望打印时不显示的内容设置class="Noprint"样式-->
<!--希望人为设置分页的位置设置class="PageNext"样式-->
<style media="print">
<!--
.Noprint{display:none;}
.PageNext{page-break-after:always;}
-->
</style>
<style type="text/css">
<!--
.STYLE1 {font-size: 12px}
-->
</style>
</HEAD>
<BODY>
<!--IE内置打印控件IEWebBrowser-->
<OBJECT id=wb height=0 width=0 classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 name=wb></OBJECT>
    <form id="form1" runat="server">
<div id = printarea runat=server>
    <uc9:PhoneRecord ID="PhoneRecord1" runat="server" />
</div>
<div>&nbsp;</div>
<DIV align=center>
<!--希望打印时不显示的内容设置class="Noprint"样式-->
<INPUT onclick=javascript:printit() type=button value=打印 name=button_print class="Noprint"/>
<INPUT onclick=javascript:printsetup(); type=button value=打印页面设置 name=button_setup
class="Noprint" />
<INPUT onclick=javascript:printpreview(); type=button value=打印预览 name=button_show class="Noprint"
/>
<input type="button" value="清空页码" onclick=javascript:pagesetup_null() class="Noprint">
<input type="button" value="恢复页码" onclick=javascript:pagesetup_default() class="Noprint">
</DIV>
    </form>
</BODY>
</HTML>
